package belf.migrate.engine.job.structure.helper;

import belf.migrate.api.model.QualifiersModel;
import belf.migrate.api.taskconf.JobContext;
import belf.migrate.api.job.Job;
import belf.migrate.engine.job.JobResult;

/**
 * 执行表任务的基类，包括创建表、删除表、创建外键、创建索引等表任务。<br/>
 * 和{@link NonTableTool}的区别在于jobContext是作为构造参数传入的。
 */
public abstract class TableTool {
    protected JobContext jobContext;
    protected Job job;

    public TableTool(JobContext jobContext, Job job) {
        this.jobContext = jobContext;
        this.job = job;
    }

    public JobContext getJobContext() {
        return jobContext;
    }

    public Job getJob() {
        return job;
    }

    public QualifiersModel getSourceQualifiersModel() {
        return jobContext.getSourceQualifiersModel();
    }

    public QualifiersModel getSinkQualifiersModel() {
        return jobContext.getSinkQualifiersModel();
    }

    abstract JobResult run();
}
